Skip to content

Improve missing-value errors for numeric comparisons#148

Merged
selkamand merged 1 commit intomainfrom
codex/improve-error-messages-for-numeric-assertions
Feb 9, 2026
Merged

Improve missing-value errors for numeric comparisons#148
selkamand merged 1 commit intomainfrom
codex/improve-error-messages-for-numeric-assertions

Conversation

@selkamand
Copy link
Owner

Motivation

  • Numeric comparison assertions previously surfaced less-clear errors when inputs contained NA/NaN; this change makes those failures report a dedicated "no missing values" message.
  • Add regression coverage so comparisons that receive NaN/NA produce the expected missing-value errors.

Description

  • Insert assert_no_missing into numeric comparison assertion chains (e.g. assert_all_greater_than, assert_all_greater_than_or_equal_to, assert_all_less_than, assert_all_less_than_or_equal_to, assert_all_between, assert_between, and related wrappers) in R/assert_compare.R so comparisons fail fast with a missing-values error.
  • Add @include has.R to R/assert_compare.R and @include assert_create.R to R/has.R to ensure symbols are available during documentation loading.
  • Add a new test block to tests/testthat/test-assert_compare.R checking that NaN (and vectors containing NaN) trigger the new missing-values error messages, and update the corresponding snapshot tests/testthat/_snaps/assert_compare.md.
  • Update NEWS.md and DESCRIPTION Collate ordering to reflect the changes.

Testing

  • Ran Rscript -e "devtools::document()" and documentation built successfully after adjusting includes.
  • Ran Rscript -e "devtools::test()" and all tests passed after accepting the updated snapshot via testthat::snapshot_accept('assert_compare').
  • Ran Rscript -e "devtools::check()" which completed but reported 1 WARNING and 1 NOTE (missing qpdf for PDF checks and "unable to verify current time"); there were no errors but R CMD check returned with warnings/notes.

Codex Task

@selkamand selkamand linked an issue Feb 9, 2026 that may be closed by this pull request
@selkamand selkamand merged commit c1da6ad into main Feb 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message of numeric comparison

1 participant